package com.lwj.liwanjia.presenter;

import com.lwj.liwanjia.bean.PwdBean;
import com.lwj.liwanjia.impl.IsSetPwdView;
import com.lwj.liwanjia.model.IsSetPwdModel;

import rx.Subscriber;

/**
 * Created by Administrator on 2017/12/1.
 */

public class IsSetPwdPresenter {
    private IsSetPwdModel isSetPwdModel;
    private IsSetPwdView isSetPwdView;

    public IsSetPwdPresenter(IsSetPwdView isSetPwdView) {
        this.isSetPwdView = isSetPwdView;
        isSetPwdModel = new IsSetPwdModel();
    }

    public void isSetPwd(String token) {
        if (isSetPwdView != null) {
            isSetPwdModel.isSetPwd(token, new Subscriber<PwdBean>() {
                @Override
                public void onCompleted() {

                }

                @Override
                public void onError(Throwable e) {
                    isSetPwdView.showError((Exception) e);
                }

                @Override
                public void onNext(PwdBean pwdBean) {
                    isSetPwdView.isSetPwd(pwdBean);
                }
            });
        }
    }
}
